﻿// --------------------------------------------------------------------------------------------------------------------- 
// <copyright file="ContentTypeInfo.cs" company="Collaboris Ltd.">
//   Copyright (c) Collaboris Ltd. All rights Reserved.
// </copyright>
// <summary>
//   Defines the ContentTypeInfo type.
// </summary>
// ---------------------------------------------------------------------------------------------------------------------
namespace Collaboris.Saf.Actions.Wss.Entities
{
    using System;
    using System.Xml.Serialization;

    using SharePoint.Wss.Attributes;
    using SharePoint.Wss.Entities;

    [CollaborisClass(Title = "ContentType Info", ReleaseStatus = ReleaseStatus.Beta,
        Summary = "Defines the parameters to support the synchronisation of content types with their parents.")]
    [Serializable]
    public class ContentTypeInfo : WSSEntityBase
    {
        #region Constants and Fields

        private string contentTypeGroupName;

        private string contentTypeName;

        private bool? excludeSystem = true;

        private bool? removeColumns = false;

        private string reportFileName;

        private bool? reportOnlyMode = true;

        private bool? updateFields = false;

        private bool? verboseReporting = false;

        private bool _copyProperties;

        #endregion

        #region Properties

        [CollaborisProperty(
            Summary =
                "Specifying the name of a content type group forces the synchronisation " +
                "to only work on that content type.", 
            Title = "Content Type Group Name",
            Example = @"", 
            Required = true, 
            InputHint = InputHint.SingleText,
            Remarks = "To run the action against all content types leave this empty (and 'ContentTypeName').")]
        public string ContentTypeGroupName
        {
            get
            {
                return this.contentTypeGroupName;
            }

            set
            {
                this.contentTypeGroupName = value;
            }
        }

        [CollaborisProperty(
            Summary =
                "Specifying the name of a content type forces the synchronisation " +
                "to only work on that content type.", 
            Title = "Content Type Name", 
            Example = @"Article Page", 
            Required = true,
            InputHint = InputHint.SingleText,
            Remarks = "To run the action against all content types leave this empty (and 'ContentTypeGroupName').")]
        public string ContentTypeName
        {
            get
            {
                return this.contentTypeName;
            }

            set
            {
                this.contentTypeName = value;
            }
        }

        [CollaborisProperty(
            Summary = "Specifies whether to exclude default SharePoint content types.",
            Title = "Exclude System Types", 
            Example = @"false", 
            Required = false, 
            InputHint = InputHint.Boolean,
            Remarks =
                "System types are identified by examining the group that contains them. " +
                "If it begins with an underscore they are classified as system types.")]
        [XmlElement(IsNullable = true)]
        public bool? ExcludeSystemTypes
        {
            get
            {
                return this.excludeSystem;
            }

            set
            {
                this.excludeSystem = value;
            }
        }

        [CollaborisProperty(
            Summary =
                "Specifies whether to delete columns that are in the parent content type, but are not in the child content type.", 
            Title = "Remove Columns", 
            Example = @"false", 
            Required = false, 
            InputHint = InputHint.Boolean)]
        [XmlElement(IsNullable = true)]
        public bool? RemoveColumns
        {
            get
            {
                return this.removeColumns;
            }
            set
            {
                this.removeColumns = value;
            }
        }

        [CollaborisProperty(
            Summary = "Specifies the full path and file name to save the generated report.",
            Title = "Report File Name", 
            Example = @"c:\temp\ContentTypesReport.txt", 
            Required = true,
            InputHint = InputHint.SingleText,
            Remarks =
                "Please ensure that the user account running the action has permissions to write to the directory.")]
        public string ReportFileName
        {
            get
            {
                return this.reportFileName;
            }
            set
            {
                this.reportFileName = value;
            }
        }

        [CollaborisProperty(
            Summary = "Specify 'True' to produce a report only (and not update the content types).",
            Title = "Report Only Mode", 
            Example = @"false", 
            Required = false, 
            InputHint = InputHint.Boolean,
            Remarks = "This property is useful if you would like to analyse your site for inconsistent content types.")]
        [XmlElement(IsNullable = true)]
        public bool? ReportOnlyMode
        {
            get
            {
                return this.reportOnlyMode;
            }

            set
            {
                this.reportOnlyMode = value;
            }
        }

        [XmlElement(IsNullable = true)]
        [Obsolete]
        public bool? UpdateFields
        {
            get
            {
                return this.updateFields;
            }

            set
            {
                this.updateFields = value;
            }
        }

        [CollaborisProperty(
            Summary = "Specify 'True' to produce a more verbose report containing more information (takes longer).",
            Title = "Verbose Reporting", 
            Example = @"false", 
            Required = true, 
            InputHint = InputHint.Boolean)]
        [XmlElement(IsNullable = true)]
        public bool? VerboseReporting
        {
            get
            {
                return this.verboseReporting;
            }

            set
            {
                this.verboseReporting = value;
            }
        }

        [CollaborisProperty(
           Summary = "Specify 'True' to copy all of the metadata about the top-level content type.",
           Title = "Verbose Reporting",
           Example = @"false",
           Required = true,
           Remarks = "The types of values that are copied to the child content type include : 'Group', 'Name', 'NewDocumentControl', 'Hidden' and more",
           InputHint = InputHint.Boolean)]
        public bool CopyProperties
        {
            get
            {
                return _copyProperties;
            }
            set
            {
                _copyProperties = value;
            }
        }

        #endregion
    }
}